function tick (elementID)
{
  if (arguments.length <1) {
      elementID="template-date-time";
  }
  var curDateTimeDiv = document.getElementById(elementID);

  var rexDateTime = /(\d\d)\/(\d\d)\/(\d\d\d\d) (\d\d):(\d\d):(\d\d)/;
  var result = curDateTimeDiv.innerHTML.match (rexDateTime);

  var day = result[1];
  var month = result[2] - 1;
  var year = result[3];
  var hour = result[4];
  var min = result[5];
  var sec = result[6];
  var year2 = parseInt(year) - 543;
  var curDateTime = new Date (year2, month, day, hour, min, sec);

  curDateTime.setTime (curDateTime.getTime() + 1000);

  day = curDateTime.getDate();
  month = curDateTime.getMonth() + 1;
  //year = curDateTime.getFullYear();
  hour = curDateTime.getHours();
  min = curDateTime.getMinutes();
  sec = curDateTime.getSeconds();

  curDateTimeDiv.innerHTML =
    zeroRightPad (day, 2) + "/" + zeroRightPad (month, 2) + "/" + zeroRightPad (year, 4) + " " +
    zeroRightPad (hour, 2) + ":" + zeroRightPad (min, 2) + ":" + zeroRightPad (sec, 2);

}

function zeroRightPad (value, length)
{
  var strValue = new String (value);
  if (strValue.length < length)
  {
    for (var i=0; i<(length-strValue.length); i++)
    {
      strValue = "0" + strValue;
    }
  }
  return strValue;
}

function getCurentBusinessDate() {
    var curDateTimeDiv = document.getElementById("template-date-time");
    var rexDateTime = /(\d\d)\/(\d\d)\/(\d\d\d\d) (\d\d):(\d\d):(\d\d)/;
    var result = curDateTimeDiv.innerHTML.match(rexDateTime);

    var day = result[1];
    var month = result[2] - 1;
    var year = result[3];
    var hour = result[4];
    var min = result[5];
    var sec = result[6];
    year = parseInt(year) - 543;
    var curDateTime = new Date (year, month, day, 0, 0, 0);
    return curDateTime;
}

function getCurrentDate() {
    var myDate = getCurentBusinessDateTime();
    var day = myDate.getDate();
    var month = myDate.getMonth() + 1;
    var year = myDate.getFullYear();
    if (day <= 9) {
        day = "0" + day;
    }
    if (month <= 9) {
        month = "0" + month;
    }
    return day + "/" + month + "/" + year;
}


function getFormatOperationTime(time){
	if(time != null){
		if(time.length >= 3){
			var mins = time.substring(time.length - 2);
			var hr = time.substring(0,time.length - 2);
			return hr +':'+ mins;
		}else
			return '';
	}else 
		return '';
}